<template>
  <div class="main">
<!--    顶部导航栏-->
    <myheader></myheader>

      <!--中间主体内容-->
      <div class="container-fluid" style="width:100%;display:-webkit-flex;align-items:stretch;">
        <!-- 侧边导航栏-->
        <div class="left_meun" >
          <div class="admin_info row pb-3">
            <div class="col-md-5">
              <el-avatar :size="100" :src="circleUrl"></el-avatar>
            </div>
            <div class="col-md-6 pt-4">
              <h4 style="font-size: 21px;font-weight: bold;color: ghostwhite">{{this.adminForm.admin_name}}</h4>
              <span style="font-size: 14px;color:#E7F957">当前登录管理员</span>
            </div>
          </div>
          <div class="pt-4">
            <el-menu
                router
                :default-active="$route.path"
                background-color="#4D4E52"
                text-color="#fff"
                active-text-color="#ffd04b"
                class="el-menu-vertical-demo"
                @open="handleOpen"
                @close="handleClose"
                :unique-opened='true'
            >

              <el-menu-item index="/Main/Show_Main" >
                <i class="el-icon-menu"></i>
                <span slot="title" class="classfont">首页</span>
              </el-menu-item>

              <el-menu-item index="/Main/Information_main" >
                <i class="el-icon-setting"></i>
                <span slot="title" class="classfont">考研资讯管理</span>
              </el-menu-item>

              <el-submenu index="/Main/Colleges_Main">
                <template slot="title">
                  <i class="el-icon-s-home"></i>
                  <span class="classfont" >院校信息管理</span>
                </template>

                <el-menu-item-group>
                  <el-menu-item index="/Main/Colleges_Main/College_Info">
                    <span class="smallclassfont">院校信息管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/Colleges_Main/College_Grade/Academic_Grades">
                    <span class="smallclassfont">考研国家线管理</span>
                  </el-menu-item>
                </el-menu-item-group>

              </el-submenu>

              <el-submenu index="/Main/Resale_Main">
                <template slot="title">
                  <i class="el-icon-s-goods"></i>
                  <span class="classfont">闲置物品管理</span>
                </template>

                <el-menu-item-group>
                  <el-menu-item index="/Main/Resale_Main/Item_Info">
                    <span class="smallclassfont">闲置物品信息管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/Resale_Main/Item_Comment">
                    <span class="smallclassfont">闲置物品评论管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/Resale_Main/Deals">
                    <span class="smallclassfont">闲置物品交易管理</span>
                  </el-menu-item>
                </el-menu-item-group>

              </el-submenu>


              <el-submenu index="/Main/Discussion_Main">
                <template slot="title">
                  <i class="el-icon-chat-line-square"></i>
                  <span class="classfont">交流讨论社区管理</span>
                </template>

                <el-menu-item-group>
                  <el-menu-item index="/Main/Discussion_Main/Post_Info">
                    <span class="smallclassfont">帖子管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/Discussion_Main/Post_Comment">
                    <span class="smallclassfont">帖子评论管理</span>
                  </el-menu-item>
                </el-menu-item-group>

              </el-submenu>


              <el-menu-item index="/Main/Score_Main">
                <i class="el-icon-present"></i>
                <span slot="title" class="classfont">积分中心管理</span>
              </el-menu-item>


              <el-submenu index="/Main/User_Main">
                <template slot="title">
                  <i class="el-icon-user"></i>
                  <span class="classfont">用户管理</span>
                </template>

                <el-menu-item-group>
                  <el-menu-item index="/Main/User_Main/Basic_Info">
                    <span class="smallclassfont">基本信息管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/User_Main/Account_Info">
                    <span class="smallclassfont">账户信息管理</span>
                  </el-menu-item>
                  <el-menu-item index="/Main/User_Main/Identity_Info">
                    <span class="smallclassfont">身份验证信息管理</span>
                  </el-menu-item>
                </el-menu-item-group>

              </el-submenu>


              <el-menu-item index="/Main/Admin_Main" v-show="this.adminForm.admin_identity">
                <i class="el-icon-user"></i>
                <span slot="title" class="classfont">管理员管理</span>
              </el-menu-item>


            </el-menu>
          </div>


        </div>


<!--        路由显示  主体内容-->
        <div class="">
          <router-view></router-view>
        </div>
      </div>
<!--    底部导航栏-->
    <myfooter></myfooter>
  </div>
</template>

<script>
import myheader from "@/components/myheader";
import myfooter from "@/components/myfooter";
import change from "@/assets/img.png"
import {getNowAdminInfo} from "@/api/Admin";


export default {
  name: "Main",
  components:{
    myheader,
    myfooter,
  },
  data() {
    return {
      isCollapse: true,
      imgs:{
        change
      },
      adminForm:{
        admin_name:'',
        admin_identity:false,
      },
      circleUrl:"https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",


    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    //获取管理员信息
    init(){
      getNowAdminInfo({
        // token: window.sessionStorage.getItem('token')
      }).then(res=>{
        this.adminForm.admin_name=res.data.admin_name;

        if(res.data.admin_identity==1){
          this.adminForm.admin_identity=true;
        }

      });
    },

  },
  mounted() {

  },
  created() {
    let _this=this;
    _this.init();
  }



}
</script>

<style scoped>
/*侧边导航栏的字体样式*/
.classfont{
  font-size: 20px;
}
.smallclassfont{
  font-size: 17px;
}
.left_meun{
  padding-top: 20px;
  padding-left: 15px;
  width:300px;
  background-color: #4D4E52;
  margin-left: -20px;
}
</style>
